package com.hontech.desktoppastacooker.conn

interface SerialPort {

    fun close()

    fun notifyClose()

    fun sync(): Int

    fun readBytes(buf: ByteArray): Int

    fun write(buf: ByteArray)

    fun writeWithLock(buf: ByteArray) {
        synchronized(this) {
            write(buf)
        }
    }

    fun writeAck(seq: Int) {
        val buf = Proto.makeAck(seq)
        writeWithLock(buf)
    }
}
